package com.clearance.mine_clearance.service.impl;
import com.clearance.mine_clearance.service.KeyboardMarkup;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.ReplyKeyboardMarkup;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.ReplyKeyboardRemove;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.buttons.InlineKeyboardButton;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.buttons.KeyboardRow;

import java.util.List;

public class KeyboardMarkupImpl implements KeyboardMarkup {

    @Override
    public ReplyKeyboardMarkup getReplyKeyboardMarkup(List<KeyboardRow> keyboardRows) {
        ReplyKeyboardMarkup replyKeyboardMarkup = new ReplyKeyboardMarkup();
        replyKeyboardMarkup.setKeyboard(keyboardRows);
        replyKeyboardMarkup.setResizeKeyboard(true); //调整键盘大小,自动适应;
        replyKeyboardMarkup.setOneTimeKeyboard(false); //要求客户在使用键盘后立即隐藏它。键盘仍然可用，但是客户端将在聊天中自动显示常用的字母键盘-用户可以在输入字段中按特殊按钮以再次查看自定义键盘。默认为false。
        return replyKeyboardMarkup;
    }
    /**
     *
     * @param text 在按钮上标记文本
     * @param url 可选的。按下按钮时将打开HTTP或tg:// URL
     * @return
     */
    @Override
    public InlineKeyboardButton getInlineKeyboardButton(String text,String url ) {
        InlineKeyboardButton inlineKeyboardButton = new InlineKeyboardButton();
        inlineKeyboardButton.setText(text);
        if(url!=null){
            inlineKeyboardButton.setUrl(url);
        }
        return inlineKeyboardButton;
    }




    @Override
    public ReplyKeyboardRemove getReplyKeyboardRemove(List<KeyboardRow> keyboardRows) {
        return null;
    }
}









